/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "gtest/gtest.h"

#include "drawing_color.h"
#include "drawing_color_filter.h"
#include "drawing_filter.h"
#include "drawing_matrix.h"
#include "drawing_path.h"
#include "drawing_path_effect.h"
#include "drawing_pen.h"
#include "drawing_point.h"
#include "drawing_rect.h"
#include "drawing_shader_effect.h"
#include "drawing_shadow_layer.h"

using namespace testing;
using namespace testing::ext;

namespace OHOS {
namespace Rosen {
namespace Drawing {
class DrawingNativePenTest : public testing::Test {
    protected:
    // 在每个测试用例执行前调用
    void SetUp() override
    {
        // 设置代码
        std::cout << "DrawingNativePenTest Setup code called before each test case." << std::endl;
        OH_Drawing_ErrorCodeReset();
        std::cout << "DrawingNativePenTest errorCodeReset before each test case." << std::endl;
    }
    void TearDown() override
    {
        std::cout << "DrawingNativePenTest Setup code called after each test case." << std::endl;
        OH_Drawing_ErrorCodeReset();
        std::cout << "DrawingNativePenTest errorCodeReset after each test case." << std::endl;
    }
};

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0100
 * @tc.name: testPenCreateNormal
 * @tc.desc: Test for testPenCreateNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenCreateNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Free the memory using OH_Drawing_PenDestroy
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0200
 * @tc.name: testPenCopyNormal
 * @tc.desc: Test for testPenCopyNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenCopyNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object 1 using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen1 = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen1, nullptr);
    // 2. Set color for pen 1 using OH_Drawing_PenSetColor
    OH_Drawing_PenSetColor(pen1, 0x00000000);
    // 3. Copy pen 1 to pen 2 using OH_Drawing_PenCopy
    OH_Drawing_Pen *pen2 = OH_Drawing_PenCopy(pen1);
    // add assert
    EXPECT_NE(pen2, nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 4. Get color of pen 2 using OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen2);
    EXPECT_EQ(color, 0x00000000);
    // 5. Modify color of pen 1 using OH_Drawing_PenSetColor
    OH_Drawing_PenSetColor(pen1, 0x00FF0000);
    // 6. Get color of pen 2 using OH_Drawing_PenGetColor
    uint32_t color2 = OH_Drawing_PenGetColor(pen2);
    EXPECT_EQ(color2, 0x00000000);
    // 7. Free the memory
    OH_Drawing_PenDestroy(pen1);
    OH_Drawing_PenDestroy(pen2);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0201
 * @tc.name: testPenCopyNull
 * @tc.desc: Test for testPenCopyNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenCopyNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Copy pen object with nullptr using OH_Drawing_PenCopy
    OH_Drawing_Pen *pen2 = OH_Drawing_PenCopy(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
    OH_Drawing_PenDestroy(pen2);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0202
 * @tc.name: testPenCopyInputDestroyed
 * @tc.desc: Test for testPenCopyInputDestroyed.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenCopyInputDestroyed, Function | SmallTest | Level3) {
    // 1. Create a pen object 1 using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen1 = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen1, nullptr);
    // 2. Copy pen 1 to pen 2 using OH_Drawing_PenCopy
    OH_Drawing_Pen *pen2 = OH_Drawing_PenCopy(pen1);
    // add assert
    EXPECT_NE(pen2, nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 3. Destroy pen 1 using OH_Drawing_PenDestroy
    OH_Drawing_PenDestroy(pen1);
    // 4. Set color for pen 2 using OH_Drawing_PenSetColor
    OH_Drawing_PenSetColor(pen2, 0x00000000);
    // 5. Get color of pen 2 using OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen2);
    EXPECT_EQ(color, 0x00000000);
    // 6. Free the memory
    OH_Drawing_PenDestroy(pen2);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0300
 * @tc.name: testPenDestroyNormal
 * @tc.desc: Test for testPenDestroyNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenDestroyNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Destroy the object using OH_Drawing_PenDestroy
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0301
 * @tc.name: testPenDestroyNull
 * @tc.desc: Test for testPenDestroyNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenDestroyNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Destroy the object with nullptr using OH_Drawing_PenDestroy
    OH_Drawing_PenDestroy(nullptr);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0400
 * @tc.name: testPenIsAntiAliasNormal
 * @tc.desc: Test for testPenIsAntiAliasNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenIsAntiAliasNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set anti-aliasing for the pen using OH_Drawing_PenSetAntiAlias
    OH_Drawing_PenSetAntiAlias(pen, true);
    // 3. Get the anti-aliasing status of the pen using OH_Drawing_PenIsAntiAlias
    bool isAntiAlias = OH_Drawing_PenIsAntiAlias(pen);
    EXPECT_EQ(isAntiAlias, true);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0401
 * @tc.name: testPenIsAntiAliasNull
 * @tc.desc: Test for testPenIsAntiAliasNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenIsAntiAliasNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenIsAntiAlias with nullptr as parameter
    bool isAntiAlias = OH_Drawing_PenIsAntiAlias(nullptr);
    EXPECT_EQ(isAntiAlias, false);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0500
 * @tc.name: testPenSetAntiAliasNormal
 * @tc.desc: Test for testPenSetAntiAliasNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetAntiAliasNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set anti-aliasing for the pen using OH_Drawing_PenSetAntiAlias
    OH_Drawing_PenSetAntiAlias(pen, true);
    // 3. Get the anti-aliasing status of the pen using OH_Drawing_PenIsAntiAlias
    bool isAntiAlias = OH_Drawing_PenIsAntiAlias(pen);
    EXPECT_EQ(isAntiAlias, true);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0501
 * @tc.name: testPenSetAntiAliasNull
 * @tc.desc: Test for testPenSetAntiAliasNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetAntiAliasNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set anti-aliasing for the pen using OH_Drawing_PenSetAntiAlias
    OH_Drawing_PenSetAntiAlias(nullptr, true);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0600
 * @tc.name: testPenGetColorNormal
 * @tc.desc: Test for testPenGetColorNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetColorNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set color for the pen using OH_Drawing_PenSetColor
    OH_Drawing_PenSetColor(pen, 0x00000000);
    // 3. Get color of the pen using OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen);
    EXPECT_EQ(color, 0x00000000);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0601
 * @tc.name: testPenGetColorNull
 * @tc.desc: Test for testPenGetColorNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetColorNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenGetColor with nullptr as parameter
    OH_Drawing_PenGetColor(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0700
 * @tc.name: testPenSetColorNormal
 * @tc.desc: Test for testPenSetColorNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetColorNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set color for the pen using OH_Drawing_PenSetColor
    OH_Drawing_PenSetColor(pen, 0x00000000);
    // 3. Get color of the pen using OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen);
    EXPECT_EQ(color, 0x00000000);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0701
 * @tc.name: testPenSetColorNull
 * @tc.desc: Test for testPenSetColorNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetColorNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set color for the pen using OH_Drawing_PenSetColor with nullptr as the first parameter
    OH_Drawing_PenSetColor(nullptr, 0x00000000);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Set color for the pen using OH_Drawing_PenSetColor with 0x00000000 as the second parameter
    OH_Drawing_PenSetColor(pen, 0x00000000);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0702
 * @tc.name: testPenSetColorAbnormal
 * @tc.desc: Test for testPenSetColorAbnormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetColorAbnormal, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the second parameter of OH_Drawing_PenSetColor to a negative number or a floating-point number
    OH_Drawing_PenSetColor(pen, -1);
    // 3. Call OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen);
    EXPECT_EQ(static_cast<uint32_t>(-1), color);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0703
 * @tc.name: testPenSetColorMaximum
 * @tc.desc: Test for testPenSetColorMaximum.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetColorMaximum, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the second parameter of OH_Drawing_PenSetColor to a maximum value of 0xFFFFFFFF + 1
    OH_Drawing_PenSetColor(pen, 0xFFFFFFFF + 1);
    // 3. Get the color of the pen using OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen);
    EXPECT_EQ(0xFFFFFFFF + 1, color);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0800
 * @tc.name: testPenGetAlphaNormal
 * @tc.desc: Test for testPenGetAlphaNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetAlphaNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the alpha value for the pen using OH_Drawing_PenSetAlpha
    OH_Drawing_PenSetAlpha(pen, 0x00);
    // 3. Get the alpha value of the pen using OH_Drawing_PenGetAlpha
    uint8_t alpha = OH_Drawing_PenGetAlpha(pen);
    EXPECT_EQ(alpha, 0x00);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0801
 * @tc.name: testPenGetAlphaNull
 * @tc.desc: Test for testPenGetAlphaNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetAlphaNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenGetAlpha with nullptr as parameter
    OH_Drawing_PenGetAlpha(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0900
 * @tc.name: testPenSetAlphaNormal
 * @tc.desc: Test for testPenSetAlphaNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetAlphaNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the alpha value for the pen using OH_Drawing_PenSetAlpha
    OH_Drawing_PenSetAlpha(pen, 0x00);
    // 3. Get the alpha value of the pen using OH_Drawing_PenGetAlpha
    uint8_t alpha = OH_Drawing_PenGetAlpha(pen);
    EXPECT_EQ(alpha, 0x00);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0901
 * @tc.name: testPenSetAlphaNull
 * @tc.desc: Test for testPenSetAlphaNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetAlphaNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the alpha value for the pen using OH_Drawing_PenSetAlpha with nullptr as the first parameter
    OH_Drawing_PenSetAlpha(nullptr, 0xff);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Set the alpha value for the pen using OH_Drawing_PenSetAlpha with 0x00 as the second parameter
    OH_Drawing_PenSetAlpha(pen, 0x00);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0902
 * @tc.name: testPenSetAlphaAbnormal
 * @tc.desc: Test for testPenSetAlphaAbnormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetAlphaAbnormal, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the second parameter of OH_Drawing_PenSetAlpha to a negative number or a floating-point number
    OH_Drawing_PenSetAlpha(pen, -1);
    // 3. Call OH_Drawing_PenGetAlpha
    uint8_t alpha = OH_Drawing_PenGetAlpha(pen);
    EXPECT_EQ(static_cast<uint8_t>(-1), alpha);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_0903
 * @tc.name: testPenSetAlphaMaximum
 * @tc.desc: Test for testPenSetAlphaMaximum.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetAlphaMaximum, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the second parameter of OH_Drawing_PenSetAlpha to a maximum value of 0xFF + 1
    uint8_t alpha1 = 0xFF;
    OH_Drawing_PenSetAlpha(pen, alpha1 + 1);
    // 3. Call OH_Drawing_PenGetAlpha
    uint8_t alpha2 = OH_Drawing_PenGetAlpha(pen);
    EXPECT_EQ(alpha2, 0);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1000
 * @tc.name: testPenGetWidthNormal
 * @tc.desc: Test for testPenGetWidthNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetWidthNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the pen width using OH_Drawing_PenSetWidth
    OH_Drawing_PenSetWidth(pen, 1.0);
    // 3. Get the pen width using OH_Drawing_PenGetWidth
    float width = OH_Drawing_PenGetWidth(pen);
    EXPECT_EQ(width, 1.0);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1001
 * @tc.name: testPenGetWidthNull
 * @tc.desc: Test for testPenGetWidthNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetWidthNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenGetWidth with nullptr as parameter
    OH_Drawing_PenGetWidth(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1002
 * @tc.name: testPenGetWidthBoundary
 * @tc.desc: Test for testPenGetWidthBoundary.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetWidthBoundary, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the pen width using OH_Drawing_PenSetWidth
    float width = 4096.0;
    OH_Drawing_PenSetWidth(pen, width);
    // 3. Get the pen width using OH_Drawing_PenGetWidth
    float getWidth = OH_Drawing_PenGetWidth(pen);
    EXPECT_EQ(width, getWidth);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1100
 * @tc.name: testPenSetWidthNormal
 * @tc.desc: Test for testPenSetWidthNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetWidthNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the pen width using OH_Drawing_PenSetWidth
    OH_Drawing_PenSetWidth(pen, 1.0);
    // 3. Get the pen width using OH_Drawing_PenGetWidth
    float width = OH_Drawing_PenGetWidth(pen);
    EXPECT_EQ(width, 1.0);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1101
 * @tc.name: testPenSetWidthNull
 * @tc.desc: Test for testPenSetWidthNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetWidthNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetWidth with nullptr as the first parameter
    OH_Drawing_PenSetWidth(nullptr, 1.00);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Call OH_Drawing_PenSetWidth with 0.00 as the second parameter
    OH_Drawing_PenSetWidth(pen, 0.00);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1102
 * @tc.name: testPenSetWidthAbnormal
 * @tc.desc: Test for testPenSetWidthAbnormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetWidthAbnormal, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the pen width using OH_Drawing_PenSetWidth with an integer or character data as the second parameter
    int width = 1;
    OH_Drawing_PenSetWidth(pen, width);
    // 3. Get the pen width using OH_Drawing_PenGetWidth
    float width2 = OH_Drawing_PenGetWidth(pen);
    EXPECT_EQ(static_cast<float>(1), width2);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1103
 * @tc.name: testPenSetWidthMultipleCalls
 * @tc.desc: Test for testPenSetWidthMultipleCalls.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetWidthMultipleCalls, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Loop through 10 times and set the pen width using OH_Drawing_PenSetWidth
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenSetWidth(pen, 1.0);
    }
    // 3. Loop through 10 times and get the pen width using OH_Drawing_PenGetWidth
    for (int i = 0; i < 10; i++) {
        float width = OH_Drawing_PenGetWidth(pen);
        EXPECT_EQ(width, 1.0);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1104
 * @tc.name: testPenSetWidthMultipleCallsBoundary
 * @tc.desc: Test for testPenSetWidthMultipleCallsBoundary.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetWidthMultipleCallsBoundary, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Loop through 10 times and set the pen width using OH_Drawing_PenSetWidth
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenSetWidth(pen, 4096.0);
    }
    // 3. Loop through 10 times and get the pen width using OH_Drawing_PenGetWidth
    for (int i = 0; i < 10; i++) {
        float width = OH_Drawing_PenGetWidth(pen);
        EXPECT_EQ(width, 4096.0);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1200
 * @tc.name: testPenGetMiterLimitNormal
 * @tc.desc: Test for testPenGetMiterLimitNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetMiterLimitNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the miter limit for the pen using OH_Drawing_PenSetMiterLimit
    OH_Drawing_PenSetMiterLimit(pen, 1.0);
    // 3. Get the miter limit using OH_Drawing_PenGetMiterLimit
    float miterLimit = OH_Drawing_PenGetMiterLimit(pen);
    EXPECT_EQ(miterLimit, 1.0);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1201
 * @tc.name: testPenGetMiterLimitNull
 * @tc.desc: Test for testPenGetMiterLimitNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetMiterLimitNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenGetMiterLimit with nullptr as parameter
    OH_Drawing_PenGetMiterLimit(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1300
 * @tc.name: testPenSetMiterLimitNormal
 * @tc.desc: Test for testPenSetMiterLimitNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetMiterLimitNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the miter limit for the pen using OH_Drawing_PenSetMiterLimit
    OH_Drawing_PenSetMiterLimit(pen, 1.0);
    // 3. Get the miter limit using OH_Drawing_PenGetMiterLimit
    float miterLimit = OH_Drawing_PenGetMiterLimit(pen);
    EXPECT_EQ(miterLimit, 1.0);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1301
 * @tc.name: testPenSetMiterLimitNull
 * @tc.desc: Test for testPenSetMiterLimitNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetMiterLimitNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetMiterLimit with nullptr as the first parameter
    OH_Drawing_PenSetMiterLimit(nullptr, 1.0);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Call OH_Drawing_PenSetMiterLimit with 0.0 as the second parameter
    OH_Drawing_PenSetMiterLimit(pen, 0.0);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1302
 * @tc.name: testPenSetMiterLimitAbnormal
 * @tc.desc: Test for testPenSetMiterLimitAbnormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetMiterLimitAbnormal, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the miter limit for the pen using OH_Drawing_PenSetMiterLimit with an integer or character data as the
    // second parameter
    int miterLimit = 1;
    OH_Drawing_PenSetMiterLimit(pen, miterLimit);
    // 3. Get the miter limit using OH_Drawing_PenGetMiterLimit
    float miterLimit2 = OH_Drawing_PenGetMiterLimit(pen);
    EXPECT_EQ(static_cast<float>(1), miterLimit2);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1303
 * @tc.name: testPenSetMiterLimitMultipleCalls
 * @tc.desc: Test for testPenSetMiterLimitMultipleCalls.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetMiterLimitMultipleCalls, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Loop through 10 times and set the miter limit for the pen using OH_Drawing_PenSetMiterLimit
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenSetMiterLimit(pen, 1.0);
    }
    // 3. Loop through 10 times and get the miter limit using OH_Drawing_PenGetMiterLimit
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenGetMiterLimit(pen);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1400
 * @tc.name: testPenGetCapNormal
 * @tc.desc: Test for testPenGetCapNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetCapNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the pen cap style using OH_Drawing_PenSetCap
    OH_Drawing_PenSetCap(pen, LINE_FLAT_CAP);
    // 3. Get the pen cap style using OH_Drawing_PenGetCap
    OH_Drawing_PenLineCapStyle cap = OH_Drawing_PenGetCap(pen);
    EXPECT_EQ(cap, LINE_FLAT_CAP);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1401
 * @tc.name: testPenGetCapNull
 * @tc.desc: Test for testPenGetCapNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetCapNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenGetCap with nullptr as parameter
    OH_Drawing_PenGetCap(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1500
 * @tc.name: testPenSetCapNormal
 * @tc.desc: Test for testPenSetCapNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetCapNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetCap with the second parameter as an enumeration by looping through the styles array
    OH_Drawing_PenLineCapStyle styles[] = {LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP};
    for (int i = 0; i < 3; i++) {
        OH_Drawing_PenSetCap(pen, styles[i]);
        // 3. Get the pen cap style using OH_Drawing_PenGetCap
        OH_Drawing_PenLineCapStyle cap = OH_Drawing_PenGetCap(pen);
        EXPECT_EQ(cap, styles[i]);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1501
 * @tc.name: testPenSetCapNull
 * @tc.desc: Test for testPenSetCapNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetCapNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetCap with nullptr as the first parameter
    OH_Drawing_PenSetCap(nullptr, LINE_FLAT_CAP);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1502
 * @tc.name: testPenSetCapMultipleCalls
 * @tc.desc: Test for testPenSetCapMultipleCalls.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetCapMultipleCalls, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Loop through 10 times and set the pen cap style using OH_Drawing_PenSetCap
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenSetCap(pen, LINE_FLAT_CAP);
    }
    // 3. Loop through 10 times and get the pen cap style using OH_Drawing_PenGetCap
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenGetCap(pen);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1600
 * @tc.name: testPenGetJoinNormal
 * @tc.desc: Test for testPenGetJoinNormal.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetJoinNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the join style for the pen using OH_Drawing_PenSetJoin
    OH_Drawing_PenSetJoin(pen, LINE_MITER_JOIN);
    // 3. Get the join style using OH_Drawing_PenGetJoin
    OH_Drawing_PenLineJoinStyle join = OH_Drawing_PenGetJoin(pen);
    EXPECT_EQ(join, LINE_MITER_JOIN);
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1601
 * @tc.name: testPenGetJoinNull
 * @tc.desc: Test for testPenGetJoinNull.
 * @tc.size: SmallTest
 * @tc.type: Function
 * @tc.level: Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetJoinNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenGetJoin with nullptr as parameter
    OH_Drawing_PenGetJoin(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1700
 * @tc.name: testPenSetJoinNormal
 * @tc.desc: test for testPenSetJoinNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetJoinNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetJoin with the second parameter as an enumeration by looping through the styles array
    OH_Drawing_PenLineJoinStyle styles[] = {LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN};
    for (int i = 0; i < 3; i++) {
        OH_Drawing_PenSetJoin(pen, styles[i]);
        // 3. Get the join style using OH_Drawing_PenGetJoin
        OH_Drawing_PenLineJoinStyle join = OH_Drawing_PenGetJoin(pen);
        EXPECT_EQ(join, styles[i]);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1701
 * @tc.name: testPenSetJoinNull
 * @tc.desc: test for testPenSetJoinNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetJoinNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetJoin with nullptr as the first parameter
    OH_Drawing_PenSetJoin(nullptr, LINE_MITER_JOIN);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1702
 * @tc.name: testPenSetJoinMultipleCalls
 * @tc.desc: test for testPenSetJoinMultipleCalls.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetJoinMultipleCalls, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Loop through 10 times and set the pen join style using OH_Drawing_PenSetJoin
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenSetJoin(pen, LINE_MITER_JOIN);
    }
    // 3. Loop through 10 times and get the pen join style using OH_Drawing_PenGetJoin
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenGetJoin(pen);
    }
    // 4. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1800
 * @tc.name: testPenSetShaderEffectNormal
 * @tc.desc: test for testPenSetShaderEffectNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetShaderEffectNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a shader object using OH_Drawing_ShaderEffectCreate
    OH_Drawing_Point *startPt = OH_Drawing_PointCreate(100, 400);
    // add assert
    EXPECT_NE(startPt, nullptr);
    OH_Drawing_Point *endPt = OH_Drawing_PointCreate(200, 500);
    // add assert
    EXPECT_NE(endPt, nullptr);
    uint32_t color[] = {0xffff0000, 0xff00ff00};
    float pos[] = {0., 1.0};
    OH_Drawing_ShaderEffect *linearGradient =
        OH_Drawing_ShaderEffectCreateLinearGradient(startPt, endPt, color, pos, 2, OH_Drawing_TileMode::CLAMP);
    // add assert
    EXPECT_NE(linearGradient, nullptr);
    // 3. Set the shader effect for the pen using OH_Drawing_PenSetShaderEffect
    OH_Drawing_PenSetShaderEffect(pen, linearGradient);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 4. Free the memory
    OH_Drawing_PointDestroy(startPt);
    OH_Drawing_PointDestroy(endPt);
    OH_Drawing_ShaderEffectDestroy(linearGradient);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1801
 * @tc.name: testPenSetShaderEffectNull
 * @tc.desc: test for testPenSetShaderEffectNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetShaderEffectNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a shader object using OH_Drawing_ShaderEffectCreate
    OH_Drawing_Point *startPt = OH_Drawing_PointCreate(100, 400);
    // add assert
    EXPECT_NE(startPt, nullptr);
    OH_Drawing_Point *endPt = OH_Drawing_PointCreate(200, 500);
    // add assert
    EXPECT_NE(endPt, nullptr);
    uint32_t color[] = {0xffff0000, 0xff00ff00};
    float pos[] = {0., 1.0};
    OH_Drawing_ShaderEffect *linearGradient =
        OH_Drawing_ShaderEffectCreateLinearGradient(startPt, endPt, color, pos, 2, OH_Drawing_TileMode::CLAMP);
    // add assert
    EXPECT_NE(linearGradient, nullptr);
    // 3. Call OH_Drawing_PenSetShaderEffect with nullptr as the first parameter
    OH_Drawing_PenSetShaderEffect(nullptr, linearGradient);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 4. Call OH_Drawing_PenSetShaderEffect with nullptr as the second parameter
    OH_Drawing_PenSetShaderEffect(pen, nullptr);
    // 5. Free the memory
    OH_Drawing_PointDestroy(startPt);
    OH_Drawing_PointDestroy(endPt);
    OH_Drawing_ShaderEffectDestroy(linearGradient);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1900
 * @tc.name: testPenSetShadowLayerNormal
 * @tc.desc: test for testPenSetShadowLayerNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetShadowLayerNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a shadow layer object using OH_Drawing_ShadowLayerCreate
    OH_Drawing_ShadowLayer *shadowLayer = OH_Drawing_ShadowLayerCreate(10, 10, 10, 0xff000000);
    // add assert
    EXPECT_NE(shadowLayer, nullptr);
    // 3. Set the shadow layer for the pen using OH_Drawing_PenSetShadowLayer
    OH_Drawing_PenSetShadowLayer(pen, shadowLayer);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 4. Free the memory
    OH_Drawing_ShadowLayerDestroy(shadowLayer);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_1901
 * @tc.name: testPenSetShadowLayerNull
 * @tc.desc: test for testPenSetShadowLayerNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetShadowLayerNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a shadow layer object using OH_Drawing_ShadowLayerCreate
    OH_Drawing_ShadowLayer *shadowLayer = OH_Drawing_ShadowLayerCreate(10, 10, 10, 0xff000000);
    // add assert
    EXPECT_NE(shadowLayer, nullptr);
    // 3. Set the shadow layer for the pen using OH_Drawing_PenSetShadowLayer with nullptr as the first parameter
    OH_Drawing_PenSetShadowLayer(nullptr, shadowLayer);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 4. Set the shadow layer for the pen using OH_Drawing_PenSetShadowLayer with nullptr as the second parameter
    OH_Drawing_PenSetShadowLayer(pen, nullptr);
    // 5. Free the memory
    OH_Drawing_ShadowLayerDestroy(shadowLayer);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2000
 * @tc.name: testPenSetPathEffectNormal
 * @tc.desc: test for testPenSetPathEffectNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetPathEffectNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a path effect object using OH_Drawing_PathEffectCreate
    float intervals[] = {1, 1, 1};
    OH_Drawing_PathEffect *pathEffect = OH_Drawing_CreateDashPathEffect(intervals, 3, 0.0);
    // add assert
    EXPECT_NE(pathEffect, nullptr);
    // 3. Set the path effect for the pen using OH_Drawing_PenSetPathEffect
    OH_Drawing_PenSetPathEffect(pen, pathEffect);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 4. Free the memory
    OH_Drawing_PathEffectDestroy(pathEffect);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2001
 * @tc.name: testPenSetPathEffectNull
 * @tc.desc: test for testPenSetPathEffectNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetPathEffectNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a path effect object using OH_Drawing_PathEffectCreate
    float intervals[] = {1, 1, 1};
    OH_Drawing_PathEffect *pathEffect = OH_Drawing_CreateDashPathEffect(intervals, 3, 0.0);
    // add assert
    EXPECT_NE(pathEffect, nullptr);
    // 3. Set the path effect for the pen with nullptr as the first parameter
    OH_Drawing_PenSetPathEffect(nullptr, pathEffect);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 4. Set the path effect for the pen with nullptr as the second parameter
    OH_Drawing_PenSetPathEffect(pen, nullptr);
    // 5. Free the memory
    OH_Drawing_PathEffectDestroy(pathEffect);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2100
 * @tc.name: testPenSetFilterNormal
 * @tc.desc: test for testPenSetFilterNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetFilterNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a filter object using OH_Drawing_FilterCreate
    OH_Drawing_Filter *filter = OH_Drawing_FilterCreate();
    // add assert
    EXPECT_NE(filter, nullptr);
    // 3. Set the filter effect for the pen using OH_Drawing_PenSetFilter
    OH_Drawing_PenSetFilter(pen, filter);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 4. Get the filter effect for the pen using OH_Drawing_PenGetFilter
    OH_Drawing_Filter *filter2 = OH_Drawing_FilterCreate();
    // add assert
    EXPECT_NE(filter2, nullptr);
    OH_Drawing_PenGetFilter(pen, filter2);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 5. Free the memory
    OH_Drawing_FilterDestroy(filter);
    OH_Drawing_FilterDestroy(filter2);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2101
 * @tc.name: testPenSetFilterNull
 * @tc.desc: test for testPenSetFilterNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetFilterNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a filter object using OH_Drawing_FilterCreate
    OH_Drawing_Filter *filter = OH_Drawing_FilterCreate();
    // add assert
    EXPECT_NE(filter, nullptr);
    // 3. Call OH_Drawing_PenSetFilter with nullptr as the first parameter
    OH_Drawing_PenSetFilter(nullptr, filter);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 4. Call OH_Drawing_PenSetFilter with nullptr as the second parameter
    OH_Drawing_PenSetFilter(pen, nullptr);
    // 5. Free the memory
    OH_Drawing_FilterDestroy(filter);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2200
 * @tc.name: testPenGetFilterNormal
 * @tc.desc: test for testPenGetFilterNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetFilterNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a filter object using OH_Drawing_FilterCreate
    OH_Drawing_Filter *filter = OH_Drawing_FilterCreate();
    // add assert
    EXPECT_NE(filter, nullptr);
    // 3. Set the filter effect for the pen using OH_Drawing_PenSetFilter
    OH_Drawing_PenSetFilter(pen, filter);
    // 4. Get the filter effect for the pen using OH_Drawing_PenGetFilter
    OH_Drawing_Filter *filter2 = OH_Drawing_FilterCreate();
    // add assert
    EXPECT_NE(filter2, nullptr);
    OH_Drawing_PenGetFilter(pen, filter2);
    // 5. Free the memory
    OH_Drawing_FilterDestroy(filter);
    OH_Drawing_FilterDestroy(filter2);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2201
 * @tc.name: testPenGetFilterNull
 * @tc.desc: test for testPenGetFilterNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetFilterNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a filter object using OH_Drawing_FilterCreate
    OH_Drawing_Filter *filter = OH_Drawing_FilterCreate();
    // add assert
    EXPECT_NE(filter, nullptr);
    // 3. Call OH_Drawing_PenGetFilter with nullptr as the first parameter
    OH_Drawing_PenGetFilter(nullptr, filter);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    OH_Drawing_ErrorCodeReset();
    // 4. Call OH_Drawing_PenGetFilter with nullptr as the second parameter
    OH_Drawing_PenGetFilter(pen, nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 5. Free the memory
    OH_Drawing_FilterDestroy(filter);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2300
 * @tc.name: testPenSetBlendModeNormal
 * @tc.desc: test for testPenSetBlendModeNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenSetBlendModeNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Use a loop to iterate through the enum values of OH_Drawing_BlendMode and call OH_Drawing_PenSetBlendMode with
    // the second parameter
    OH_Drawing_BlendMode modes[] = {BLEND_MODE_CLEAR, BLEND_MODE_SRC, BLEND_MODE_DST};
    for (int i = 0; i < 3; i++) {
        OH_Drawing_ErrorCodeReset();
        OH_Drawing_PenSetBlendMode(pen, modes[i]);
        // add assert
        EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    }
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2301
 * @tc.name: testPenSetBlendModeNull
 * @tc.desc: test for testPenSetBlendModeNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetBlendModeNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenSetBlendMode with nullptr as the first parameter
    OH_Drawing_PenSetBlendMode(nullptr, BLEND_MODE_CLEAR);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2400
 * @tc.name: testPenGetFillPathNormal
 * @tc.desc: test for testPenGetFillPathNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenGetFillPathNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a source path object using OH_Drawing_PathCreate
    OH_Drawing_Path *srcPath = OH_Drawing_PathCreate();
    // add assert
    EXPECT_NE(srcPath, nullptr);
    // 3. Create a destination path object using OH_Drawing_PathCreate
    OH_Drawing_Path *dstPath = OH_Drawing_PathCreate();
    // add assert
    EXPECT_NE(dstPath, nullptr);
    // 4. Create a rectangle object using OH_Drawing_RectCreate
    OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
    // add assert
    EXPECT_NE(rect, nullptr);
    // 5. Create a matrix object using OH_Drawing_MatrixCreate
    OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
    // add assert
    EXPECT_NE(matrix, nullptr);
    // 6. Call OH_Drawing_PenGetFillPath
    bool isSuccess = OH_Drawing_PenGetFillPath(pen, srcPath, dstPath, rect, matrix);
    // add assert
    EXPECT_EQ(isSuccess, false);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 7. Free the memory
    OH_Drawing_PathDestroy(srcPath);
    OH_Drawing_PathDestroy(dstPath);
    OH_Drawing_RectDestroy(rect);
    OH_Drawing_MatrixDestroy(matrix);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2401
 * @tc.name: testPenGetFillPathNull
 * @tc.desc: test for testPenGetFillPathNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetFillPathNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Create a source path object using OH_Drawing_PathCreate
    OH_Drawing_Path *srcPath = OH_Drawing_PathCreate();
    // add assert
    EXPECT_NE(srcPath, nullptr);
    // 3. Create a destination path object using OH_Drawing_PathCreate
    OH_Drawing_Path *dstPath = OH_Drawing_PathCreate();
    // add assert
    EXPECT_NE(dstPath, nullptr);
    // 4. Create a rectangle object using OH_Drawing_RectCreate
    OH_Drawing_Rect *rect = OH_Drawing_RectCreate(100, 100, 200, 200);
    // add assert
    EXPECT_NE(rect, nullptr);
    // 5. Create a matrix object using OH_Drawing_MatrixCreate
    OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreate();
    // add assert
    EXPECT_NE(matrix, nullptr);
    // 6. Call OH_Drawing_PenGetFillPath with nullptr as the first parameter
    OH_Drawing_PenGetFillPath(nullptr, srcPath, dstPath, rect, matrix);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    OH_Drawing_ErrorCodeReset();
    // 7. Call OH_Drawing_PenGetFillPath with nullptr as the second parameter
    OH_Drawing_PenGetFillPath(pen, nullptr, dstPath, rect, matrix);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    OH_Drawing_ErrorCodeReset();
    // 8. Call OH_Drawing_PenGetFillPath with nullptr as the third parameter
    OH_Drawing_PenGetFillPath(pen, srcPath, nullptr, rect, matrix);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 9. Call OH_Drawing_PenGetFillPath with nullptr as the fourth parameter
    bool isSuccess1 = OH_Drawing_PenGetFillPath(pen, srcPath, dstPath, nullptr, matrix);
    // add assert
    EXPECT_EQ(isSuccess1, false);
    // 10. Call OH_Drawing_PenGetFillPath with nullptr as the fifth parameter
    bool isSuccess2 = OH_Drawing_PenGetFillPath(pen, srcPath, dstPath, rect, nullptr);
    // add assert
    EXPECT_EQ(isSuccess2, false);
    // 11. Free the memory
    OH_Drawing_PathDestroy(srcPath);
    OH_Drawing_PathDestroy(dstPath);
    OH_Drawing_RectDestroy(rect);
    OH_Drawing_MatrixDestroy(matrix);
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2500
 * @tc.name: testPenResetNormal
 * @tc.desc: test for testPenResetNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 0
 */
HWTEST_F(DrawingNativePenTest, testPenResetNormal, Function | SmallTest | Level0) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Set the pen color using OH_Drawing_PenSetColor
    OH_Drawing_PenSetColor(pen, 0xff0000ff);
    // 3. Get the pen color using OH_Drawing_PenGetColor
    uint32_t color = OH_Drawing_PenGetColor(pen);
    EXPECT_EQ(0xff0000ff, color);
    // 4. Reset the pen state using OH_Drawing_PenReset
    OH_Drawing_PenReset(pen);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_SUCCESS);
    // 5. Get the pen color using OH_Drawing_PenGetColor
    color = OH_Drawing_PenGetColor(pen);
    OH_Drawing_Pen *pen2 = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen2, nullptr);
    uint32_t color2 = OH_Drawing_PenGetColor(pen2);
    EXPECT_EQ(color2, color);
    // 6. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2501
 * @tc.name: testPenResetNull
 * @tc.desc: test for testPenResetNull.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenResetNull, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Call OH_Drawing_PenReset with nullptr as the parameter
    OH_Drawing_PenReset(nullptr);
    // add assert
    EXPECT_EQ(OH_Drawing_ErrorCodeGet(), OH_Drawing_ErrorCode::OH_DRAWING_ERROR_INVALID_PARAMETER);
    // 3. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2502
 * @tc.name: testPenResetMultipleCalls
 * @tc.desc: test for testPenResetMultipleCalls.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenResetMultipleCalls, Function | SmallTest | Level3) {
    // 1. Create a pen object using OH_Drawing_PenCreate
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    // add assert
    EXPECT_NE(pen, nullptr);
    // 2. Use a loop to call OH_Drawing_PenSetColor and set the pen color 10 times
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenSetColor(pen, 0xff0000ff);
    }
    // 3. Use a loop to call OH_Drawing_PenGetColor and get the pen color 10 times
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenGetColor(pen);
    }
    // 4. Use a loop to call OH_Drawing_PenReset and reset the pen state 10 times
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenReset(pen);
    }
    // 5. Use a loop to call OH_Drawing_PenGetColor and get the pen color 10 times
    for (int i = 0; i < 10; i++) {
        OH_Drawing_PenGetColor(pen);
    }
    // 6. Free the memory
    OH_Drawing_PenDestroy(pen);
}

/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2600
 * @tc.name: testPenGetAlphaFloatNormal
 * @tc.desc: test for testPenGetAlphaFloatNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 2
 */
HWTEST_F(DrawingNativePenTest, testPenGetAlphaFloatNormal, Function | SmallTest | Level2) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float a = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetAlphaFloat(pen, &a), OH_DRAWING_SUCCESS);
    EXPECT_EQ(a, 1.0f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2601
 * @tc.name: testPenGetAlphaFloatAbnormal
 * @tc.desc: test for testPenGetAlphaFloatAbnormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetAlphaFloatAbnormal, Function | SmallTest | Level3) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float a = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetAlphaFloat(nullptr, &a), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetAlphaFloat(pen, 0), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetAlphaFloat(pen, NULL), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(a, 0.0f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2700
 * @tc.name: testPenGetRedFloatNormal
 * @tc.desc: test for testPenGetRedFloatNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 2
 */
HWTEST_F(DrawingNativePenTest, testPenGetRedFloatNormal, Function | SmallTest | Level2) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float r = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetRedFloat(pen, &r), OH_DRAWING_SUCCESS);
    EXPECT_EQ(r, 0.4f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2701
 * @tc.name: testPenGetRedFloatAbnormal
 * @tc.desc: test for testPenGetRedFloatAbnormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetRedFloatAbnormal, Function | SmallTest | Level3) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float r = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetRedFloat(nullptr, &r), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetRedFloat(pen, 0), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetRedFloat(pen, NULL), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(r, 0.0f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2800
 * @tc.name: testPenGetGreenFloatNormal
 * @tc.desc: test for testPenGetGreenFloatNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 2
 */
HWTEST_F(DrawingNativePenTest, testPenGetGreenFloatNormal, Function | SmallTest | Level2) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float g = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetGreenFloat(pen, &g), OH_DRAWING_SUCCESS);
    EXPECT_EQ(g, 1.0f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2801
 * @tc.name: testPenGetGreenFloatAbnormal
 * @tc.desc: test for testPenGetGreenFloatAbnormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetGreenFloatAbnormal, Function | SmallTest | Level3) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float g = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetGreenFloat(nullptr, &g), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetGreenFloat(pen, 0), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetGreenFloat(pen, NULL), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(g, 0.0f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2900
 * @tc.name: testPenGetBlueFloatNormal
 * @tc.desc: test for testPenGetBlueFloatNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 2
 */
HWTEST_F(DrawingNativePenTest, testPenGetBlueFloatNormal, Function | SmallTest | Level2) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float b = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetBlueFloat(pen, &b), OH_DRAWING_SUCCESS);
    EXPECT_EQ(b, 0.2f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_2901
 * @tc.name: testPenGetBlueFloatAbnormal
 * @tc.desc: test for testPenGetBlueFloatAbnormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenGetBlueFloatAbnormal, Function | SmallTest | Level3) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float b = 0.f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    EXPECT_EQ(OH_Drawing_PenGetBlueFloat(nullptr, &b), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetBlueFloat(pen, 0), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(OH_Drawing_PenGetBlueFloat(pen, NULL), OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(b, 0.0f);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_3000
 * @tc.name: testPenSetColor4fNormal
 * @tc.desc: test for testPenSetColor4fNormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 2
 */
HWTEST_F(DrawingNativePenTest, testPenSetColor4fNormal, Function | SmallTest | Level2) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float a = 0.0f;
    float r = 0.0f;
    float g = 0.0f;
    float b = 0.0f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_ErrorCode errorCode = OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    OH_Drawing_PenGetAlphaFloat(pen, &a);
    OH_Drawing_PenGetRedFloat(pen, &r);
    OH_Drawing_PenGetGreenFloat(pen, &g);
    OH_Drawing_PenGetBlueFloat(pen, &b);
    EXPECT_EQ(a, 1.0f);
    EXPECT_EQ(r, 0.4f);
    EXPECT_EQ(g, 1.0f);
    EXPECT_EQ(b, 0.2f);
    EXPECT_EQ(errorCode, OH_DRAWING_SUCCESS);
    OH_Drawing_PenDestroy(pen);
}
/*
 * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_PEN_3001
 * @tc.name: testPenSetColor4fAbnormal
 * @tc.desc: test for testPenSetColor4fAbnormal.
 * @tc.size  : SmallTest
 * @tc.type  : Function
 * @tc.level : Level 3
 */
HWTEST_F(DrawingNativePenTest, testPenSetColor4fAbnormal, Function | SmallTest | Level3) {
    OH_Drawing_Pen *pen = OH_Drawing_PenCreate();
    float a = 0.0f;
    float r = 0.0f;
    float g = 0.0f;
    float b = 0.0f;
    OH_Drawing_PenSetWidth(pen, 10);
    OH_Drawing_ErrorCode errorCode1 = OH_Drawing_PenSetColor4f(nullptr, 1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    OH_Drawing_ErrorCode errorCode2 = OH_Drawing_PenSetColor4f(pen, 1.2f, 0.4f, 1.0f, 0.2f, nullptr);
    OH_Drawing_PenGetAlphaFloat(pen, &a);
    EXPECT_EQ(a, 1.0f);
    OH_Drawing_ErrorCode errorCode3 = OH_Drawing_PenSetColor4f(pen, -1.0f, 0.4f, 1.0f, 0.2f, nullptr);
    OH_Drawing_PenGetAlphaFloat(pen, &a);
    EXPECT_EQ(a, 0.0f);
    OH_Drawing_ErrorCode errorCode4 = OH_Drawing_PenSetColor4f(pen, 1.0f, 1.4f, 1.0f, 0.2f, nullptr);
    OH_Drawing_PenGetRedFloat(pen, &r);
    EXPECT_EQ(r, 1.0f);
    OH_Drawing_ErrorCode errorCode5 = OH_Drawing_PenSetColor4f(pen, 1.0f, -0.4f, 1.0f, 0.2f, nullptr);
    OH_Drawing_PenGetRedFloat(pen, &r);
    EXPECT_EQ(r, 0.0f);
    OH_Drawing_ErrorCode errorCode6 = OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.2f, 0.2f, nullptr);
    OH_Drawing_PenGetGreenFloat(pen, &g);
    EXPECT_EQ(g, 1.0f);
    OH_Drawing_ErrorCode errorCode7 = OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, -1.0f, 0.2f, nullptr);
    OH_Drawing_PenGetGreenFloat(pen, &g);
    EXPECT_EQ(g, 0.0f);
    OH_Drawing_ErrorCode errorCode8 = OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, 1.2f, nullptr);
    OH_Drawing_PenGetBlueFloat(pen, &b);
    EXPECT_EQ(b, 1.0f);
    OH_Drawing_ErrorCode errorCode9 = OH_Drawing_PenSetColor4f(pen, 1.0f, 0.4f, 1.0f, -0.2f, nullptr);
    OH_Drawing_PenGetBlueFloat(pen, &b);
    EXPECT_EQ(b, 0.0f);
    EXPECT_EQ(errorCode1, OH_DRAWING_ERROR_INVALID_PARAMETER);
    EXPECT_EQ(errorCode2, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode3, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode4, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode5, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode6, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode7, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode8, OH_DRAWING_SUCCESS);
    EXPECT_EQ(errorCode9, OH_DRAWING_SUCCESS);
    OH_Drawing_PenDestroy(pen);
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS